package com.cqc;

import org.apache.tika.Tika;
import org.apache.tika.exception.TikaException;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;

import java.io.File;
import java.io.IOException;

public class TikaTest {
    static Tika tika;

    @BeforeAll
    public static void beforeAll() {
        tika = new Tika();
    }

    @Test
    public void test() throws TikaException, IOException {

//        String filePath = "C:\\Users\\cuiquancheng\\Desktop\\1.doc";
//        String filePath = "C:\\Users\\cuiquancheng\\Desktop\\润和\\润和-Java工程师-崔泉城.docx";
        String filePath = "C:\\Users\\cuiquancheng\\Desktop\\05.淘淘商城-day05-v2.1.pdf";
        File file = new File(filePath);
        System.out.println(file.exists());
        String content = tika.parseToString(file);
        System.out.println(content);
    }
}
